package org.spring.springboot.service;

import java.util.ArrayList;
import java.util.List;

import org.spring.springboot.entity.Student;
import org.spring.springboot.entity.User;
import org.spring.springboot.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StudentService {
	
	@Autowired
	private StudentMapper studentMapper;
	
	//查询
	public Student selectStudentById(int id) {
		return studentMapper.selectStudentById(id);
	}
	
	//新增
    public boolean insertStudent() {
    	List<Student> list = new ArrayList<>();
    	for (int i = 0; i <2; i++) {
    		Student student = new Student();
    		student.setCourse(String.valueOf(i*10));
    		student.setName("刘"+i);
    		student.setScore(String.valueOf(i*10));
    		list.add(student);
        }
    	studentMapper.insertStudent(list);
        return true;
    }
    

}
